<template>
  <div class="page-header">
    <span class="title">{{ title }}</span>
    <div v-if="$slots.default" class="header-buttons">
      <slot></slot>
    </div>
  </div>
</template>

<script setup>
defineProps({
  title: {
    type: String,
    required: true
  }
})
</script>

<style lang="scss" scoped>
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 56px;
  line-height: 56px;
  padding: 0 20px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 2;
}

.page-header .title {
  font-size: 16px;
  font-weight: 500;
  color: #1e293b;
  text-align: left;
  flex: 1;
}

.page-header .header-buttons {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

/* 移动端适配 */
@media screen and (max-width: 768px) {
  .page-header {
    height: auto;
    padding: 12px 16px;
    flex-direction: row;
    gap: 12px;
    align-items: flex-start;
  }

  .page-header .title {
    font-size: 16px;
    line-height: 40px;
    text-align: left;
  }
}
</style>
